package com.lgc.javathread.locktest.deadlock;

public class A extends Thread {
    private final Object lockA;
    private final Object lockB;

    public A(Object lockA, Object lockB) {
        this.lockA = lockA;
        this.lockB = lockB;
    }

    @Override
    public void run() {
        synchronized (lockA) {
            try {
                Thread.sleep(1000);
                System.out.println("This A");
                synchronized (lockB) {
                    System.out.println("Hello A");
                }

            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
